<!--
/**
* Author: linchun
* Date: 2022-08-03 21:07
* Desc: MoreCouponPopup 精选优惠劵弹窗
*/
-->
<template>
  <zm-popup
    v-model="show"
    @close="close"
    :closeable="false"
    model="bottom"
    :round="25"
  >
    <view class="show-panel home-wrap">
      <coupon-info
        v-if="info.discountPackageList.length > 0 && show"
        :list="info.discountPackageList"
        :is-checked="info.checkActive === 'discountPackage'"
        :check-package-id="info.checkPackageId"
        :choose-counpon-num="info.chooseCounponNum"
        :ticket-num="info.ticketNum"
        :able-package-coupon-len="info.ablePackageCouponLen"
        :discount-price="info.singleSalePrice"
        :has-commerce-price="hasCommercePrice"
        @clickCouponCheck="clickCouponCheck"
      >
      </coupon-info>
    </view>
  </zm-popup>
</template>

<script>
  import ZmPopup from '@/commons/ZmPopup'
  import CouponInfo from '../CouponInfo'
  export default {
    name: '',
    components: {
      ZmPopup,
      CouponInfo
    },
    props: {
      value: {
        type: Boolean,
        default: false
      },
      hasCommercePrice: {
        type: Boolean,
        default: false
      },
      info: {
        type: Object,
        default() {
          return {}
        }
      }
    },
    computed: {
      show: {
        set(v) {
          this.$emit('input', v)
        },
        get() {
          return this.value
        }
      }
    },
    data() {
      return {
        chooseItem: {}
      }
    },
    methods: {
      close() {
        this.$emit('input', false)
      },
      clickCouponCheck(item, curChooseNum) {
        this.chooseItem = item
        this.$emit('clickCouponCheck', item, curChooseNum)
        this.$emit('chooseItem', this.chooseItem, curChooseNum)
        // this.close()
      }
    }
  }
</script>
<style lang="scss" scoped>
  .show-panel {
    min-height: 400rpx;
    height: auto;
    max-height: 858rpx;
    width: 100%;
    margin: 16rpx 0 30rpx 0;
    overflow-x: hidden;
    overflow-y: auto;
    box-sizing: border-box;
  }
</style>
